home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1999 February
/
Macworld (1999-02).dmg
/
Cinema 4D GO demo
/
Gumption Plug-ins
/
Plug-ins
/
Freeware
/
DistCalc
/
DistCalc.cof
Wrap
Text File
|
1998-03-14
|
2KB
|
101 lines
/*------------------------------------------------------------------------------
* File name: DistCalc.cof
*
* Date Who What & Why
* =========== =========== ====================================================
* 1998/03/10 Y.Manabe • new
*-----------------------------------------------------------------------------*/
DistCalc(doc)
{
var d = new(SimpleDialog);
var camera, obj1, obj2, obj3;
var cameraName, obj1Name, obj2Name, obj3Name;
var cameraPosition, objPosition;
var tmpMatrix = new(Matrix);
// Displlay Dialog, and get camera & obj names
d->SetData(0, "Camera", FIELD_STRING, 0, 0, "Camera");
d->SetData(1, "Object1", FIELD_STRING, 0, 0, "Object1");
d->SetData(2, "Object2", FIELD_STRING, 0, 0, "Object2");
d->SetData(3, "Object3", FIELD_STRING, 0, 0, "Object3");
d->SetTitle("Dist.Calc.");
if (d->DoDialog() != TRUE)
{
return FALSE;
} // end if != true
cameraName = d->GetData(0);
obj1Name = d->GetData(1);
obj2Name = d->GetData(2);
obj3Name = d->GetData(3);
camera = doc->FindObject(d->GetData(0));
obj1 = doc->FindObject(d->GetData(1));
obj2 = doc->FindObject(d->GetData(2));
obj3 = doc->FindObject(d->GetData(3));
if (camera == NULL)
{
TextDialog(stradd("Can't find ", cameraName),
DLG_OK + DLG_ICONEXCLAMATION);
return TRUE;
} // end if camera
else
{
camera->GetMg(tmpMatrix);
cameraPosition = tmpMatrix->MulP(vector(0));
} // end else
OpenConsole();
if (obj1 != NULL)
{
println(stradd("From ", cameraName, " to ", obj1Name));
obj1->GetMg(tmpMatrix);
objPosition = tmpMatrix->MulP(vector(0));
println(vlen(objPosition - cameraPosition));
println("");
} // end if obj1
else
{
println(stradd("Can't find ", obj1Name));
println("");
} // end else
if (obj2 != NULL)
{
println(stradd("From ", cameraName, " to ", obj2Name));
obj2->GetMg(tmpMatrix);
objPosition = tmpMatrix->MulP(vector(0));
println(vlen(objPosition - cameraPosition));
println("");
} // end
else
{
println(stradd("Can't find ", obj2Name));
println("");
} // end else
if (obj3 != NULL)
{
println(stradd("From ", cameraName, " to ", obj3Name));
obj3->GetMg(tmpMatrix);
objPosition = tmpMatrix->MulP(vector(0));
println(vlen(objPosition - cameraPosition));
println("");
} // end
else
{
println(stradd("Can't find ", obj3Name));
println("");
} // end else
return TRUE;
}
main()
{
RegisterMenuHook("DistCalc", "DistCalc");
} // end main()